home *** CD-ROM | disk | FTP | other *** search
/ Internet Surfer 2.0 / Internet Surfer 2.0 (Wayzata Technology) (1996).iso / pc / textfile / faqs / puzz_faq / part14 < prev    next >
Encoding:
Internet Message Format  |  1992-12-26  |  59.4 KB

  1. Xref: bloom-picayune.mit.edu rec.puzzles:18151 news.answers:3082
  2. Newsgroups: rec.puzzles,news.answers
  3. Path: bloom-picayune.mit.edu!enterpoop.mit.edu!snorkelwacker.mit.edu!usc!sol.ctr.columbia.edu!destroyer!uunet!questrel!chris
  4. From: uunet!questrel!chris (Chris Cole)
  5. Subject: rec.puzzles FAQ, part 14 of 15
  6. Message-ID: <puzzles-faq-14_717034101@questrel.com>
  7. Followup-To: rec.puzzles
  8. Summary: This posting contains a list of
  9.      Frequently Asked Questions (and their answers).
  10.      It should be read by anyone who wishes to
  11.      post to the rec.puzzles newsgroup.
  12. Sender: chris@questrel.com (Chris Cole)
  13. Reply-To: uunet!questrel!faql-comment
  14. Organization: Questrel, Inc.
  15. References: <puzzles-faq-1_717034101@questrel.com>
  16. Date: Mon, 21 Sep 1992 00:09:53 GMT
  17. Approved: news-answers-request@MIT.Edu
  18. Expires: Sat, 3 Apr 1993 00:08:21 GMT
  19. Lines: 1574
  20.  
  21. Archive-name: puzzles-faq/part14
  22. Last-modified: 1992/09/20
  23. Version: 3
  24.  
  25. ==> logic/verger.s <==
  26. The puzzler tried to take the test;
  27. Intriguing rhymes he wished to best.
  28. But "Fifty and ten dozens twenty"
  29. made his headache pound aplenty.
  30. When he finally found some leisure,
  31. He took to task this witty treasure.
  32.  
  33. "The product of the age must be
  34. Twenty-Four Hundred Fifty!"
  35. Knowing that, he took its primes,
  36. permuted them as many times
  37. as needed, til he found amounts
  38. equal to, by all accounts,
  39. twice the Verger's age, so that
  40. He would have that next day's spat.
  41.  
  42. The reason for the lad's confusion
  43. was due to multiple solution!
  44. Hence he needed one more clue
  45. to give the answer back to you!
  46. Since only one could fit the bill,
  47. and then confirm the priest's age still,
  48. the eldest age of each solution
  49. by one could differ, with no coercion.  <=(Sorry)
  50.  
  51. Else, that last clue's revelation
  52. would not have brought information!
  53. With two, two, five, seven, and seven,
  54. construct three ages, another set of seven.
  55. Two sets of three yield sixty-four,
  56. Examine them, yet one time more.
  57. The eldest age of each would be
  58. forty-nine, and then, fifty!
  59.  
  60. With lack of proper rhyme and meter,
  61. I've tried to be the first completor
  62. of this poem and a puzzle;
  63. my poetry, you'd try to muzzle!
  64. And lest you think my wit is thrifty,
  65. The answer, of course, must be fifty!
  66. If dispute, you wish to tender,
  67. note my addresss, as the sender!
  68.  
  69. -- 
  70. Kevin Nechodom <knechod@stacc.med.utah.edu>
  71.  
  72. ==> logic/weighing/balance.p <==
  73. You are given N balls and a balance scale and told that
  74. one ball is slightly heavier or lighter than the other identical
  75. ones.  The scale lets you put the same number of balls on each side
  76. and observe which side (if either) is heavier.
  77.  
  78. 1.     What's the minimum # of weighings X (and way of doing them)
  79. that will always find the unique ball and whether it's heavy or light?
  80.  
  81. 2.     If you are told the unique ball is, in fact, heavier than the
  82. others, what's the minimum # of weighings Y to find it?
  83.  
  84. ==> logic/weighing/balance.s <==
  85. Martin Gardner gave a neat solution to this problem.
  86.  
  87. Assume that you are allowed N weighings.  Write down the 3^N possible
  88. length N strings of the symbols '0', '1', and '2'.  Eliminate the three
  89. such strings that consist of only one symbol repeated N times.
  90.  
  91. For each string, find the first symbol that is different from the symbol
  92. preceeding it.  Consider that pair of symbols.  If that pair is not 01,
  93. 12, or 20, cross out that string.  In other words, we only allow strings
  94. of the forms 0*01.*, 1*12.*, or 2*20.* ( using ed(1) regular expressions ).
  95.  
  96. You will have (3^N-3)/2 strings left.  This is how many balls you can
  97. handle in N weighings.
  98.  
  99. Perform N weighings as follows:
  100.  
  101.     For weighing I, take all the balls that have a 0 in string
  102.     position I, and weigh them against all the balls that have
  103.     a 2 in string position I. 
  104.  
  105.     If the side with the 0's in position I goes down, write down
  106.     a 0.  If the other side goes down, write down a 2.  Otherwise,
  107.     write down a 1.
  108.  
  109. After the N weighings, you have written down an N symbol string.  If
  110. your string matches the string on one of the balls, then that is the
  111. odd ball, and it is heavy.  If none of them match, than change every
  112. 2 to a 0 in your string, and every 0 to a 2.  You will then have a
  113. string that matches one of the balls, and that ball is lighter than
  114. the others.
  115.  
  116. Note that if you only have to identify the odd ball, but don't have to
  117. determine if it is heavy or light, you can handle (3^N-3)/2+1 balls.
  118. Label the extra ball with a string of all 1's, and use the above
  119. method.
  120.  
  121. Note also that you can handle (3^N-3)/2+1 balls if you *do* have to
  122. determine whether it is heavy or light, provided you have a single reference
  123. ball available, which you know has the correct weight. You do this by
  124. labelling the extra ball with a string of all 2s. This results in it being
  125. placed on the same side of the scales each time, and in that side of the
  126. scales having one more ball than the other each time. So you put the
  127. reference ball on the other side of the scales to the "all 2s" ball on each
  128. weighing.
  129.  
  130. Proving that this works is straightforward, once you notice that the
  131. method of string construction makes sure that in each position, 1/3
  132. of the strings have 0, 1/3 have 1, and 1/3 have 2, and that if a
  133. string occurs, then the string obtained by replacing each 0 with a
  134. 2 and each 2 with a 0 does not occur.
  135.  
  136. ==> logic/weighing/box.p <==
  137. You have ten boxes; each contains nine balls.  The balls in one box
  138. weigh 0.9 kg; the rest weigh 1.0 kg.  You have one weighing on a
  139. scale to find the box containing the light balls.  How do you do it?
  140.  
  141. ==> logic/weighing/box.s <==
  142. Number the boxes 0-9.  Take 0 balls from box 0, 1 ball from box 1, 2
  143. balls from box 2, etc.  Now weight all those balls and follow this
  144. table:
  145.  
  146. If odd box is    Weight is
  147. 0        45 kg
  148. 1        44.9 kg
  149. 2        44.8 kg
  150. 3        44.7 kg
  151. 4        44.6 kg
  152. 5        44.5 kg
  153. 6        44.4 kg
  154. 7        44.3 kg
  155. 8        44.2 kg
  156. 9        44.1 kg
  157.  
  158. ==> logic/weighing/gummy.bears.p <==
  159. Real gummy drop bears have a mass of 10 grams, while imitation gummy
  160. drop bears have a mass of 9 grams.  Spike has 7 cartons of gummy drop bears,
  161. 4 of which contain real gummy drop bears, the others imitation.
  162. Using a scale only once and the minimum number of gummy drop bears, how
  163. can Spike determine which cartons contain real gummy drop bears?
  164.  
  165. ==> logic/weighing/gummy.bears.s <==
  166. Spike used 51 gummy drop bears:  from the 7 boxes he took respectively
  167. 0, 1, 2, 4, 7, 13, and 24 bears.
  168.  
  169. The notion is that each box of imitation bears will subtract its
  170. number of bears from the total "ideal" weight of 510 grams (1 gram of
  171. missing weight per bear), so Spike weighs the bears, subtracts the
  172. result from 510 to obtain a number N, and finds the unique combination
  173. of 3 numbers from the above list (since there are 3 "imitation" boxes)
  174. that sum to N.
  175.  
  176. The trick is for the sums of all triples selected from the set S of
  177. numbers of bears to be unique.  To accomplish this, I put numbers into
  178. S one at a time in ascending order, starting with the obvious choice,
  179. 0.  (Why is this obvious?  If I'd started with k > 0, then I could
  180. have improved on the resulting solution by subtracting k from each
  181. number) Each new number obviously had to be greater than any previous,
  182. because otherwise sums are not unique, but also the sums it made when
  183. paired with any previous number had to be distinct from all previous
  184. pairs (otherwise when this pair is combined with a third number you
  185. can't distinguish it from the other pair)--except for the last box,
  186. where we can ignore this point.  And most obviously all the new
  187. triples had to be distinct from any old triples; it was easy to find
  188. what the new triples were by adding the newest number to each old sum
  189. of pairs.
  190.  
  191. Now, in case you're curious, the possible weight deficits and their
  192. unique decompositions are:
  193.  
  194. 3       = 0 + 1 + 2
  195. 5       = 0 + 1 + 4
  196. 6       = 0 + 2 + 4
  197. 7       = 1 + 2 + 4
  198. 8       = 0 + 1 + 7
  199. 9       = 0 + 2 + 7
  200. 10      = 1 + 2 + 7
  201. 11      = 0 + 4 + 7
  202. 12      = 1 + 4 + 7
  203. 13      = 2 + 4 + 7
  204. 14      = 0 + 1 + 13
  205. 15      = 0 + 2 + 13
  206. 16      = 1 + 2 + 13
  207. 17      = 0 + 4 + 13
  208. 18      = 1 + 4 + 13
  209. 19      = 2 + 4 + 13
  210. 20      = 0 + 7 + 13
  211. 21      = 1 + 7 + 13
  212. 22      = 2 + 7 + 13
  213. 24      = 4 + 7 + 13
  214. 25      = 0 + 1 + 24
  215. 26      = 0 + 2 + 24
  216. 27      = 1 + 2 + 24
  217. 28      = 0 + 4 + 24
  218. 29      = 1 + 4 + 24
  219. 30      = 2 + 4 + 24
  220. 31      = 0 + 7 + 24
  221. 32      = 1 + 7 + 24
  222. 33      = 2 + 7 + 24
  223. 35      = 4 + 7 + 24
  224. 37      = 0 + 13 + 24
  225. 38      = 1 + 13 + 24
  226. 39      = 2 + 13 + 24
  227. 41      = 4 + 13 + 24
  228. 44      = 7 + 13 + 24
  229.  
  230. Note that there had to be (7 choose 3) distinct values; they end up
  231. ranging from 3 to 44 inclusive with 7 numbers missing:  4, 23, 34, 36,
  232. 40, 42, and 43.
  233.  
  234. -- David Karr (karr@cs.cornell.edu)
  235.  
  236. ==> logic/weighing/weighings.p <==
  237. Some of the supervisors of Scandalvania's n mints are producing bogus coins.
  238. It would be easy to determine which mints are producing bogus coins but,
  239. alas, the only scale in the known world is located in Nastyville,
  240. which isn't on very friendly terms with Scandalville.  In fact, Nastyville's
  241. king will only let you use the scale twice.  Your job?  You must determine
  242. which of the n mints are producing the bogus coins using only two weighings
  243. and the minimum number of coins (your king is rather parsimonious, to put it
  244. nicely).  This is a true scale, i.e. it will tell you the weight of whatever
  245. you put on it.  Good coins are known to have a weight of 1 ounce and it is
  246. also known that all the bogus mints (if any) produce coins that are
  247. light or heavy by the same amount.
  248.  
  249. Some examples: if n=1 then we only need 1 coin, if n=2 then clearly 2
  250. coins suffice, one from each mint.
  251.  
  252. What are the solutions for n=3,4,5?  What can be said for general n?
  253.  
  254. ==> logic/weighing/weighings.s <==
  255. Oh gracious and wise king, I have solved this problem by first
  256. simplifying and then expanding.  That is, consider the problem of
  257. being allowed only a single weighing.  Stop reading right now if you
  258. want to think about it further.
  259.  
  260. There are three possible outcomes for each mint (light, OK, heavy)
  261. which may be represented as (-1, 0, +1).  Now, let each mint represent
  262. one place in base 3.  Thus, the first mint is the ones place, the
  263. second the threes place, the third is the nines place and so on.  The
  264. number of coins from each mint must equal the place.  That is, we'll
  265. have 1 coin from mint 1, 3 from mint 2, 9 from mint 3, and, in
  266. general, 3^(n-1) from mint n.
  267.  
  268. By weighing all coins at once, we will get a value between 1 + 3 + 9 +
  269. ...  and -1 + -3 + -9 + ...  In fact, we notice that that value will
  270. be unique for any mint outcomes.  Thus, for the one weighing problem,
  271. we need
  272.  
  273. sum for i=1 to n (3^(i-1))
  274.  
  275. which evaluates to (3^n - 1)/2
  276.  
  277. I'm fairly satisfied that this is a minimum for a single weighing.
  278. What does a second weighing give us?  Well, we can divide the coins
  279. into two groups and use the same method.  That is, if we have 5 mints,
  280. one weighing will be:
  281.  
  282. 1 coin from mint 1 + 3 coins from mint 2 + 9 coins from mint 3
  283.  
  284. while the other weighing will be:
  285.  
  286. 1 coin from mint 4 + 3 coins from mint 5
  287.  
  288. It's pretty plain that this gives us a total coinage of:
  289.  
  290.    3^(n/2) - 1 for even n and, after some arithmetic agitation:
  291.    2 * 3^((n-1)/2) - 1 for odd n
  292.  
  293. I think the flaw in this solution is that we don't know ahead of time
  294. the amount by which the coins are off weight.  So if you weigh 1 coin
  295. from mint 1 together with 3 coins from mint 2 and the result is heavy
  296. by 3x units, you still don't know whether the bogus coins are from
  297. mint 3 (heavy by x units) or from mint 1 (heavy by 3x units).  Note
  298. that we're not given the error amount, only the fact that is is equal
  299. for all bogus coins.
  300.  
  301. Here is my partial solution:
  302.  
  303. After considering the above, it would seem that on each of the two
  304. weighings we must include coins from all of the mints (except for the
  305. special cases of small n).  So let ai (a sub i) be the number of coins
  306. from mint i on weighing 1 and bi be the number of coins from mint i on
  307. weighing 2.  Let the error in the bogus coins have a value x, and let
  308. ci be a the counterfeit function: ci is 0 if mint i is good, 1
  309. otherwise.
  310.  
  311. Then
  312.     Sum   ai ci x = delta1        error on weighing 1
  313.     Sum   bi ci x = delta2        error on weighing 2
  314.  
  315. Now the ratio of delta1 to delta2 will be rational regardless of the
  316. value of x, since x will factor out; let's call this ratio p over q (p
  317. and q relatively prime).  We would like to choose { ai } and { bi }
  318. such that for any set of mints J, which will be a subset of { 1 , 2 ,
  319. ... , n }, that
  320.  
  321.     Sum aj    ( = Sum  ai ci ) is relatively prime to Sum bj.
  322.  
  323. If this is true then we can determine the error x; it will simply be
  324. delta1/p, which is equal to  delta2/q.
  325.  
  326. If the { ai } have been carefully chosen, we should be able to figure
  327. out the bogus mints from one of the weighings, provided that
  328. all subsets ( { { aj } over all J } ) have unique sums.
  329. This was the strategy proposed above, where is was suggested
  330. that ai = 3 ** (i-1) ; note that you can use base 2 instead
  331. of base 3 since all the errors have the same sign.
  332.  
  333. Well, for the time being I'm stumped.
  334.  
  335. This agrees with the analysis I've been fighting with.  I actually
  336. came up with a pair of functions that "almost" works.  So that the
  337. rest of you can save some time (in case you think the way I did):
  338.     Weighing 1: 1 coin from each mint
  339.     Weighing 2: 2^(k-1) coins from mint k, for 1...k...n 
  340.     (total 2^n - 1 coins)
  341.  
  342. Consider the n mints to be one-bit-each -- bit set -> mint makes bogus
  343. coins.  Then we can just state that we're trying to discover "K",
  344. where K is a number whose bit pattern _just_ describes the bogosity of
  345. each mint.  OK - now, assuming we know 'x', and we only consider the
  346. *difference* of the weighing from what it should be, for weighing 1,
  347. the devaiation is just the Hamming weight of K -- that is the number
  348. of 1-bits in it -- that is, the number of bogosifying mints.  For
  349. weighing 2, the deviation is just K!  When the nth bit of K is set,
  350. then that mint contributes just 2^n to the deviation, and so the total
  351. deviation will just be K.
  352.  
  353. So that set me in search of a lemma: given H(x) is the hamming weight
  354. of x, is f(x) = x / H(x) a 1-1 map integers into rationals?  That is,
  355. if x/H(x) = y/H(y) can we conclude that x = y?
  356.  
  357. The answer (weep) is NO.  The lowest pair I could find are 402/603
  358. (both give the ratio 100.5).  Boy it sure looked like a good
  359. conjecture for a while!  Sigh.
  360.  
  361.  
  362. There are two parts to the problem. First let us try to come up with a 
  363. solution to finding the answer in 2 weighings - then worry about using the
  364. min. number of coins.
  365. Solutions are for GENERAL n.
  366.  
  367. Let N = set of all mints, 1 to n. Card(N) = n.
  368. Let P = set of all bogus mints. Let Card(P) = p.
  369.  
  370. Weighing I: Weigh n coins, 1 from each mint.
  371.  
  372. Since each "good" coins weighs one ounce, let delta1 be the error in weighing.
  373. Since all bogus coins are identical, let delta1 be abs(error).
  374. If x is the weight by which one bogus coin differs from a good coin,
  375.  delta1 = p * x.
  376.  
  377. Weighing II: The coins to be weighed are composed thusly.
  378.  
  379. Let a1 be the number of coins from mint 1, a2 # from mint2 .. and an from
  380. mint n. All ai's are distinct integers.
  381.  
  382. Let A = Set of all ai's.
  383.  
  384. Let delta2 = (abs.) error in weighing 2 = x * k
  385.     where k is the number of coins that are bogus in weighing two.
  386. Or more formally
  387.         k = sigma(ai)
  388.          (over all i in P)
  389.  
  390. Assuming p is not zero (from Weighing I - in that case go back and get beheaded
  391. for giving the king BAAAAAD advice), 
  392.     Let ratio = delta1/delta2 = p/k.
  393.     Let IR = delta2/delta1 = k/p = inverse-ratio (for later proof).
  394.  
  395. Let S(i) be the bag of all numbers generated by summing i distinct elements 
  396. from A. Clearly there will be nCi (that n comb. i) elements in S(i).
  397.  
  398. [A bag is a set that can have the same element occur more than once.]
  399.  
  400. So S(1) = A
  401. and S(n) will have one element that is the sum of all the elements of A.
  402.  
  403. Let R(i) = {x : For-all y in S(i), x = i/y} expressed as p/q (no common 
  404.                                 factors).
  405. (R is a bag too).
  406.  
  407. Let R-A = Bag-Union(R(i) for 1>= i >=n). (can include same element twice)
  408.  
  409. Choose A, such that all elements of R-A are DISTINCT, i.e. Bag(R-A) = Set(R-A).
  410.  
  411. Let the sequence a1, a2, .. an, be an L-sequence if the above property is
  412. true. Or more simply, A is in L.
  413.  
  414. **********************************************************************
  415. CONJECTURE: The bogus mint problem is solved in two weighings if A is in L.
  416.  
  417. Sketchy proof: R(1) = all possible ratios (= delta1/delta2) when p=1.
  418. R(i) = all possible ratio's when p=i.
  419.  
  420. Since all possible combinations of bogus mints are reflected in R, just match
  421. the actual ratio with the generated table for n.
  422.  
  423. ************************************************************************
  424. A brief example. Say n=3. Skip to next line if you want.
  425. Let A=(2,3,7).
  426.  
  427. p=1 possible ratios = 1/2 1/3 1/7
  428. p=2 possible ratios = 2/5 2/9 1/5(2/10)
  429. p=3 possible ratios = 1/4(3/12) (lots of blood in Scandalvania).
  430.  
  431. As all outcomes are distinct, and the actual ratio MUST be one of these,
  432. match it to the answer, and start sharpening the axe.
  433.  
  434. Note that the minimum for n=3 is A=(0,1,3)
  435. possible ratios are 
  436. p=1 infinity (delta2=0),1,1/3
  437. p=2 2/1,2/3,1/2
  438. p=3 3/4
  439.  
  440. ************************************************************************
  441.  
  442. All those with the determination to get this far are saying OK, OK how do we
  443. get A.
  444.  
  445. I propose a solution that will generate A, to give you the answer in two
  446. weighings, but will not give you the optimal number of coins.
  447.  
  448. Let a1=0
  449.  
  450. For i>=2 >=n
  451.  
  452. ai = i*(a1 + a2 + ... + ai-1) + 1
  453.  
  454. *****************************************
  455. *        i-1            *
  456. *    ai = i* [Sigma(aj)] + 1     *   ****Generator function G*****
  457. *        j=1            *
  458. *****************************************
  459.  
  460. If A is L, all RATIO's are unique. Also all inverse-ratio's (1/ratio) are
  461. unique. I will prove that all inverse-ratio's (or IR's) are unique.
  462.  
  463. Let A(k), be the series generated by the first k elements from eqn. G.(above)
  464.  
  465. ************************************************************************
  466.  
  467. PROOF BY INDUCTION.
  468.  
  469. A(1) = {0} is in L.
  470. A(2) = {0,1} is in L.
  471.  
  472. ASSUME A(k) = {0,1, ..., ak} is in L.
  473.  
  474. T.P.T. A(k+1) = {0,1, ..., ak, D) is in L where D is generated from G.
  475.  
  476. We know that all IR's(inverse ratio's)  from A(k) are distinct.
  477.  
  478. Let K = set of all IR's of A(k).
  479.  
  480. Since A(k+1) contains A(k), all IR's of A(k) will also be IR's of A(K+1).
  481.  
  482. So for all P, such that (k+1) is not in P, we get a distinct IR.
  483.  
  484. So consider cases when (k+1) is in P.
  485.  
  486. p=1 (i.e. (k+1) = only bogus mint), IR = D
  487.  
  488. ______________________________________________________________________
  489. CONJECTURE: Highest IR for A(k) = max(K) = ak
  490.  
  491. Proof:     Since max[A(k)] = ak,
  492.         for p'= 1, max IR = ak/1 = ak
  493.         for p'= 2, max IR (max sum of 2 ai's)/2
  494.                = (ak + ak-1)/2 < ak (as ak>ak-1).
  495.         for p'= i max IR sum of largest i elements of A(k)
  496.                       --------------------------------
  497.                         i
  498.                 < i * ak/i = ak.
  499.     So max. IR for A(k) is ak.
  500. ______________________________________________________________________
  501.  
  502. D > ak
  503. So for p=1 IR is distinct.
  504.  
  505. Let Xim be the IR formed by choosing i elements from A(k+1). 
  506.     Note: We are choosing D and (i-1) elements from A(k).
  507.           m is just an index to denote each distinct combination of
  508.           (i-1) elemnts of A(i).
  509.  
  510. ______________________________________________________________________
  511. CONJECTURE : For p=j, all new IR's Xjm are limited to the range
  512.          D/(j-1) > Xjm > D/j.
  513.  
  514. Proof:
  515.     Xjm = (D + {j-1 elements of A(k)})/j
  516.  
  517.     Clearly Xjm > D/j.
  518.  
  519.     To show: max[Xjm] < D/(j-1)
  520.  
  521.     Note: a1 + a2 .. + ak < D/(k+1)
  522.  
  523.        max[Xjm] = (D + ak + ak-1 +  ... + a(k-j+1))/j
  524.         < (D + D/(k+1))/j
  525.         = D (k+2)/(k+1)j
  526.         = [D/(j-1)] * alpha.
  527.  
  528.     alpha = (j-1)/(j)  *  (k+2)/(k+1)
  529.         
  530.         Since j <= k, (j-1)/j <= (k-1)/k < (k+1)/(k+2)
  531.  
  532.     IMPLIES alpha < 1.
  533.  
  534. Conjecture proved.
  535.  
  536. ______________________________________________________________________
  537. CONJECTURE : For a given p, all newly generated IR's are distinct.
  538.  
  539. Proof by contradiction:
  540.  
  541. Assume this is not so.
  542.  
  543. Implies
  544.     (D + (p-1) elements of A(k))/p 
  545.     = (D + some other (p-1) elements of A(k))/p 
  546.  
  547. Implies SUM[(p-1) elements of A(k)] = SUM[ some other (p-1) elements of A(k)]
  548.  
  549. Implies SUM[(p-1) elements of A(k)]/(p-1) 
  550.         = SUM[some other (p-1) elements]/(p-1)
  551.  
  552. Implies A(k) is NOT in L.
  553.  
  554. Contra.
  555.  
  556. Hence conjecture.
  557. ______________________________________________________________________
  558.  
  559. CONJECTURE: A(k+1) is in L.
  560.  
  561. Since all newly generated IR's are distinct from each other, and all newly generated IR's are greater than previous IR's, A(k+1) is in L.
  562.  
  563. ==> logic/zoo.p <==
  564.  I took some nephews and nieces to the Zoo, and we halted at a cage marked
  565.  
  566.             Tovus Slithius, male and female.
  567.           Beregovus Mimsius, male and female.
  568.              Rathus Momus, male and female.
  569.         Jabberwockius Vulgaris, male and female.
  570.  
  571.  The eight animals were asleep in a row, and the children began to guess
  572.  which was which.  "That one at the end is Mr Tove."  "No, no!  It's Mrs
  573.  Jabberwock," and so on.  I suggested that they should each write down
  574.  the names in order from left to right, and offered a prize to the one
  575.  who got most names right.
  576.  
  577.  As the four species were easily distinguished, no mistake would arise in
  578.  pairing the animals; naturally a child who identified one animal as Mr
  579.  Tove identified the other animal of the same species as Mrs Tove.
  580.  
  581.  The keeper, who consented to judge the lists, scrutinised them carefully.
  582.  "Here's a queer thing.  I take two of the lists, say, John's and Mary's.
  583.  The animal which John supposes to be the animal which Mary supposes to be
  584.  Mr Tove is the animal which Mary supposes to be the animal which John
  585.  supposes to be Mrs Tove.  It is just the same for every pair of lists,
  586.  and for all four species.
  587.  
  588.  "Curiouser and curiouser!  Each boy supposes Mr Tove to be the animal
  589.  which he supposes to be Mr Tove; but each girl supposes Mr Tove to be
  590.  the animal which she supposes to be Mrs Tove.  And similarly for the oth-
  591.  er animals.  I mean, for instance, that the animal Mary calls Mr Tove
  592.  is really Mrs Rathe, but the animal she calls Mrs Rathe is really Mrs
  593.  Tove."
  594.  
  595.  "It seems a little involved," I said, "but I suppose it is a remarkable
  596.  coincidence."
  597.  
  598.  "Very remarkable," replied Mr Dodgson (whom I had supposed to be the
  599.  keeper) "and it could not have happened if you had brought any more
  600.  children."
  601.  
  602.  How many nephews and nieces were there?  Was the winner a boy or a girl?
  603.  And how many names did the winner get right?    [by Sir Arthur Eddington]
  604.  
  605. ==> logic/zoo.s <==
  606. Given that there is at least one boy and one girl (John and Mary are
  607. mentioned) then the answer is that there were 3 nephews and 2 nieces,
  608. the winner was a boy who got 4 right.
  609.  
  610. Number the animals 1 through 8, such that the females are even and the
  611. males are odd, with members of the same species consecutive; i.e.
  612. 1 is Mr. Tove, 2 Mrs. Tove, etc.
  613.  
  614. Then each childs guesses can be represented by a permutation.  I use
  615. the standard notation of a permutation as a set of orbits.
  616. For example: (1 3 5)(6 8) means 1 -> 3, 3 -> 5, 5 -> 1, 6 -> 8, 8 -> 6
  617. and 2,4,7 are unchanged.
  618.  
  619. [1]  Let P be any childs guesses.  Then P(mate(i)) = mate(P(i)).
  620.  
  621. [2]  If Q is another childs guesses, then [P,Q] = T, where
  622. [P,Q] is the commutator of P and Q (P composed with Q composed with
  623. P inverse composed with Q inverse) and T is the special permutation
  624. (1 2) (3 4) (5 6) (7 8) that just swaps each animal with its spouse.
  625.  
  626. [3]  If P represents a boy, then P*P = I (I use * for composition, and I
  627. for
  628. the identity permutation: (1)(2)(3)(4)(5)(6)(7)(8)
  629.  
  630. [4]  If P represents a girl, then P*P = T.
  631.  
  632. [1] and [4] together mean that all girl's guesses must be of the form:
  633.     (A B C D) (E F G H) where A and C are mates, as are B & D, E & F
  634.     G & H.
  635.  
  636. So without loss of generality let Mary = (1 3 2 4) (5 7 6 8)
  637. Without to much effort we see that the only possibilities for other
  638. girls "compatible" with Mary (I use compatible to mean the relation
  639. expressed in [2]) are:
  640.     g1:  (1 5 2 6) (3 8 4 7)
  641.     g2:  (1 6 2 5) (3 7 4 8)
  642.     g3:  (1 7 2 8) (3 5 4 6)
  643.     g4:  (1 8 2 7) (3 6 4 5)
  644.  
  645. Note that g1 is incompatible with g2 and g3 is incompatible with g4.
  646. Thus no 4 of Mary and g1-4 are mutually compatible.  Thus there are at
  647. most three girls: Mary, g1 and g3 (without loss of generality)
  648.  
  649. By [1] and [3], each boy must be represented as a product of
  650. transpostions and/or singletons: e.g. (1 3) (2 4) (5) (6) (7) (8) or
  651. (1) (2) (3 4) (5 8) (6 7).
  652.  
  653. Let J represent John's guesses and consider J(1).
  654. If J(1) = 1, then J(2) = 2 (by [1]) using [2] and Mary J(3) = 4, J(4) =
  655. 3,  and g1 & J => J(5) = 6, J(6) = 5, & g3 & J => J(8) = 7 J(7) = 8
  656. i.e. J = (1)(2)(3 4)(5 6)(7 8).  But the [J,Mary] <> T.  In fact, we
  657. can see that J must have no fixed points, J(i) <> i for all i, since
  658. there is nothing special about i = 1.
  659.  
  660. If J(1) = 2, then we get from Mary that J(3) = 3.  contradiction.
  661.  
  662. If J(1) = 3, then J(2) = 4, J(3) = 1, J(4) = 2 (from Mary) =>
  663.    J(5) = 7, J(6) = 8, J(7) = 5, J(8) = 6 => J = (1 3)(2 4)(5 7)(6 8)
  664.    (from g1)
  665. But then J is incompatible with g3.
  666.  
  667. A similar analysis shows that J(1) cannot be 4,5,6,7 or 8; i.e. no J 
  668. can be compatible with all three girls.  So without loss of generality,
  669. throw away g3.
  670.  
  671. We have Mary = (1 3 2 4) (5 7 6 8)
  672.         g1   = (1 5 2 6) (3 8 4 7)
  673.  
  674. The following are the only possible boy guesses which are compatible
  675. with
  676. both of these:
  677.  
  678.   B1: (1)(2)(3 4)(5 6)(7)(8)
  679.   B2: (1 2)(3)(4)(5)(6)(7 8)
  680.   B3: (1 3)(2 4)(5 7)(6 8)
  681.   B4: (1 4)(2 3)(5 8)(6 7)
  682.   B5: (1 5)(2 6)(3 8)(4 7)
  683.   B6: (1 6)(2 5)(3 7)(4 8)
  684.  
  685. Note that B1 & B2 are incombatible, as are B3 & B4, B5 & B6, so at most
  686. three
  687. of them are mutually compatible.  In fact, Mary, g1, B1, B3 and B5 are
  688. all
  689. mutually compatible (as are all the other possibilities you can get by
  690. choosing
  691. either B1 or B2, B3 or B4, B5 or B6.  So if there are 2 girls there can
  692. be
  693. 3 boys, but no more, and we have already eliminated the case of 3 girls
  694. and
  695. 1 boy.
  696.  
  697. The only other possibility to consider is whether there can be 4 or more
  698. boys 
  699. and 1 girl.  Suppose there are Mary and 4 boys.  Each boy must map 1 to
  700. different digit or they would not be mutually compatible.  For example
  701. if b1 
  702. and b2 both map 1 to 3, then they both map 3 to 1 (since a boy's map
  703. consists 
  704. of transpositions), so both b1*b2 and b2*b1 map 1 to 1.  Furthermore, b1
  705. and 
  706. b2 cannot map 1 onto spouses.  For example, if b1(1) = a and b is the
  707. spouse
  708. of a, then b1(2) = b.  If b2(1) = b, then b2(2) = a.  Then
  709. b1*b2(1) = b1(b) = 2 and b2*b1(1) = b2(a) = 2 (again using the fact that
  710. boys
  711. are all transpostions).  Thus the four boys must be:
  712.  
  713. B1: (1)(2)...    or (1 2)....
  714. B2: (1 3)...     or (1 4) ...
  715. B3: (1 5) ...    or (1 6) ...
  716. B4: (1 7) ...    or (1 8) ...
  717.  
  718. Consider B4.  The only permutation of the form (1 7)... which is
  719. compatible
  720. with Mary ( (1 3 2 4) (5 7 6 8) ) is:
  721.  
  722.    (1 7)(2 8)(3 5)(4 6)
  723.  
  724. The only (1 8)... possibility is:
  725.  
  726.    (1 8)(2 7)(3 6)(4 5)
  727.  
  728. Suppose B4 = (1 7)(2 8)(3 5)(4 6)
  729.  
  730. If B3 starts (1 5), it must be (1 5)(2 6)(3 8)(4 7) to be compatible
  731. with B4.
  732. This is compatible with Mary also.
  733.  
  734. Assuming this and B2 starts with (1 3) we get B2 = (1 3)(2 4)(5 8)(6 7)
  735. in 
  736. order to be compatible with B4.  But then B2*B3 and B3*B2 moth map 1 to
  737. 8.
  738. I.e. no B2 is mutually compatible with B3 & B4.
  739.  
  740. Similarly if B2 starts with (1 4) it must be (1 4)(2 3)(5 7)(6 8) to
  741. work
  742. with B4, but this doesn't work with B3.
  743.  
  744. Likewise B3 starting with (1 6) leads to no possible B2 and the
  745. identical
  746. reasoning eliminates B4 = (1 8)...
  747.  
  748. So no B4 is possible!
  749.  
  750. I.e at most 3 boys are mutually compatiblw with Mary, so 2 girls & 3
  751. boys is optimal.
  752.  
  753. Thus:
  754.  
  755. Mary = (1 3 2 4) (5 7 6 8)
  756. Sue  = (1 5 2 6) (3 8 4 7)  
  757. John = (1)(2)(3 4)(5 6)(7)(8)
  758. Bob  = (1 3)(2 4)(5 7)(6 8)
  759. Jim  = (1 5)(2 6)(3 8)(4 7)
  760.  
  761. is one optimal solution, with the winner being John (4 right: 1 2 7 & 8)
  762. ==> physics/balloon.p <==
  763. A helium-filled balloon is tied to the floor of a car that makes a
  764. sharp right turn.  Does the balloon tilt while the turn is made?
  765. If so, which way?  The windows are closed so there is no connection
  766. with the outside air.
  767.  
  768. ==> physics/balloon.s <==
  769. Because of buoyancy, the helium balloon on the string will want to move
  770. in the direction opposite the effective gravitational field existing
  771. in the car.  Thus, when the car turns the corner, the balloon will
  772. deflect towards the inside of the turn.
  773.  
  774. ==> physics/bicycle.p <==
  775. A boy, a girl and a dog go for a 10 mile walk. The boy and girl can
  776. walk 2 mph and the dog can trot at 4 mph. They also have bicycle
  777. which only one of them can use at a time. When riding, the boy and
  778. girl can travel at 12 mph while the dog can peddle at 16 mph.
  779. What is the shortest time in which all three can complete the trip?
  780.  
  781. ==> physics/bicycle.s <==
  782. First note that there's no apparent way to benefit from letting either the
  783. boy or girl ride the bike longer than the other.  Any solution which gets the
  784. boy there faster, must involve him using the bike (forward) more; similarly
  785. for the girl.  Thus the bike must go backwards more for it to remain within
  786. the 10-mile route.  Thus the dog won't make it there in time.  So the solution
  787. assumes they ride the bike for the same amount of time.
  788.  
  789. Also note that there's no apparent way to benefit from letting any of the three
  790. arrive at the finish ahead of the others.  If they do, they can probably take
  791. time out to help the others.  So the solution assumes they all finish at the
  792. same time.
  793.  
  794. The boy starts off on the bike, and travels 5.4 miles.  At this
  795. point, he drops the bike and completes the rest of the trip on foot.  The
  796. dog eventually reaches the bike, and takes it *backward* .8 miles (so the
  797. girl gets to it sooner) and then returns to trotting.  Finally, the girl makes
  798. it to the bike and rides it to the end.  The answer is 2.75 hours.
  799.  
  800. The puzzle is in Vasek Chvatal, Linear Programming, W. H. Freeman & Co.
  801. The generalized problem (n people, 1 bike, different walking and riding speeds)
  802. is known as "The Bicycle Problem".  A couple references are
  803.  
  804. Masuda, S. (1970). "The bicycle problem," University of California, Berkeley:
  805.   Operations Research Center Technical Report ORC 70-35.
  806.  
  807. Chvatal, V. (1983). "On the bicycle problem," Discrete Applied Mathematics 5:
  808.   pp. 165 - 173.
  809.  
  810. As for the linear program which gives the lower bound of 2.75 hours, let
  811. t[person, mode, direction] by the amount of time "person" (boy, girl or dog)
  812. is travelling by "mode" (walk or bike) in "direction" (forward or backwards).
  813. Define Time[person] to be the total time spent by person doing each of these
  814. four activities. The objective is to minimize the maximum of T[person], for
  815. person = boy, girl, dog, e.g.
  816.  
  817.     minimize T
  818.     subject to  T >= T[boy], T >= T[girl], T >= T[dog].
  819.  
  820. Now just think of all the other linear constraints on the variables t[x,y,z],
  821. such as everyone has to travel 10 miles, etc. In all, there are 8 contraints
  822. in 18 variables (including slack variables). Solving this program yields the
  823. lower bound.
  824.  
  825. ==> physics/boy.girl.dog.p <==
  826. A boy, a girl and a dog are standing together on a long, straight road.
  827. Simulataneously, they all start walking in the same direction:
  828. The boy at 4 mph, the girl at 3 mph, and the dog trots back and forth
  829. between them at 10 mph.  Assume all reversals of direction instantaneous.
  830. In one hour, where is the dog and in which direction is he facing?
  831.  
  832. ==> physics/boy.girl.dog.s <==
  833. The dog's position and direction are indeterminate, other than that the
  834. dog must be between the boy and girl (endpoints included).  To see this,
  835. simply time reverse the problem.  No matter where the dog starts out,
  836. the three of them wind up together in one hour.
  837.  
  838. This argument is not quite adequate.  It is possible to construct problems
  839. where the orientation changes an infinite number of times initially, but for
  840. which there can be a definite result.  This would be the case if the positions
  841. at time t are uniformly continuous in the positions at time s, s small. 
  842.  
  843. But suppose that at time a the dog is with the girl.  Then the boy is at
  844. 4a, and the time it takes the dog to reach the boy is a/6, because
  845. the relative speed is 6 mph.  So the time b at which the dog reaches the
  846. boy is proportional to a.  A similar argument shows that the time the 
  847. dog next reaches the girl is b + b/13, and is hence proportional to b.
  848. This makes the position of the dog at time (t > a) a periodic function of
  849. the logarithm of a, and thus does not approach a limit as a -> 0.
  850.  
  851. ==> physics/brick.p <==
  852. What is the maximum overhang you can create with an infinite supply of bricks? 
  853.  
  854. ==> physics/brick.s <==
  855. You can create an infinite overhang.
  856.  
  857. Let us reverse the problem: how far can brick 1 be from brick 0?
  858.  
  859. Let us assume that the brick is of length 1.
  860.  
  861. To determine the place of the center of mass a(n):
  862. a(1)=1/2
  863. a(n)=1/n[(n-1)*a(n-1)+[a(n-1)+1/2]]=a(n-1)+1/(2n)
  864. Thus
  865.       n   1        n  1
  866. a(n)=Sum -- = 1/2 Sum - = 1/2 H(n)
  867.      m=1 2m       m=1 m
  868. Needless to say the limit for n->oo of half the Harmonic series is oo.
  869.  
  870. ==> physics/cannonball.p <==
  871. A person in a boat drops a cannonball overboard; does the water level change?
  872.  
  873. ==> physics/cannonball.s <==
  874. The cannonball in the boat displaces an amount of water equal to the MASS
  875. of the cannonball.  The cannonball in the water displaces an amount of water
  876. equal to the VOLUME of the cannonball.  Water is unable to support the
  877. level of salinity it would take to make it as dense as a cannonball, so the
  878. first amount is definitely more than the second amount, and the water level
  879. drops.
  880.  
  881. ==> physics/dog.p <==
  882. A body of soldiers form a 50m-by-50m square ABCD on the parade ground.
  883. In a unit of time, they march forward 50m in formation to take up the
  884. position DCEF. The army's mascot, a small dog, is standing next to its
  885.                                        handler at location A. When the
  886.           B----C----E                  soldiers start marching, the dog
  887.           |    |    |   forward-->     begins to run around the moving
  888.           A----D----F                  body in a clockwise direction,
  889.                                        keeping as close to it as possible.
  890. When one unit of time has elapsed, the dog has made one complete
  891. circuit and has got back to its handler, who is now at location D. (We
  892. can assume the dog runs at a constant speed and does not delay when
  893. turning the corners.)
  894.  
  895. How far does the dog travel?
  896.  
  897. ==> physics/dog.s <==
  898. Let L be the side of the square, 50m, and let D be the distance the
  899. dog travels.
  900.  
  901. Let v1 be the soldiers' marching speed and v2 be the speed of the dog.
  902. Then v1 = L / (1 time unit) and v2 = v1*D/L.
  903.  
  904. Let t1, t2, t3, t4 be the time the dog takes to traverse each side of
  905. the square, in order.  Find t1 through t4 in terms of L and D and solve
  906. t1+t2+t3+t4 = 1 time unit.
  907.  
  908. While the dog runs along the back edge of the square in time t1, the
  909. soldiers advance a distance d=t1*v1, so the dog has to cover a distance
  910. sqrt(L^2 + (t1*v1)^2), which takes a time t1=sqrt(L^2 + (t1*v1)^2)/v2.
  911. Solving for t1 gives t1=L/sqrt(v2^2 - v1^2).
  912.  
  913. The rest of the times are t2 = L/(v2-v1), t3 = t1, and t4 = L/(v2+v1).
  914.  
  915. In t1+t2+t3+t4, eliminate v2 by using v2=v1*D/L and eliminate v1 by
  916. using v1=L/(1 time unit), obtaining
  917.  
  918.         2 L (D + sqrt(D^2-L^2)) / (D^2 - L^2) = 1
  919.  
  920. which can be turned into
  921.  
  922.         D^4 - 4LD^3 - 2L^2D^2 + 4L^3D + 5L^4 = 0
  923.  
  924. which has a root D = 4.18113L = 209.056m.
  925.  
  926. ==> physics/magnets.p <==
  927. You have two bars of iron.  One is magnetic, the other is not.  Without
  928. using any other instrument (thread, filings, other magnets, etc.), find
  929. out which is which.
  930.  
  931. ==> physics/magnets.s <==
  932. Take the two bars, and put them together like a T, so that one bisects the
  933. other.
  934.                        ___________________
  935.           bar A --->  |___________________|
  936.                                | |
  937.                                | |
  938.                                | |
  939.                                | |
  940.           bar B ------------>  | |
  941.                                | |
  942.                                | |
  943.                                |_|
  944.  
  945. If they stick together, then bar B is the magnet.  If they don't, bar A is
  946. the magnet. (reasoning follows)
  947.  
  948. Bar magnets are "dead" in their centers (ie there is no magnetic force,
  949. since the two poles cance out).  So, if bar A is the magnet, then bar B
  950. won't stick to its center.
  951.  
  952. However, bar magnets are quite "alive" at their edges (ie the magnetic
  953. force is concentrated).  So, if bar B is the magnet, then bar A will stick
  954. nicely to its end.
  955.  
  956. ==> physics/milk.and.coffee.p <==
  957. You are just served a hot cup of coffee and want it to be as hot as possible
  958. when you drink it some number of minutes later.  Do you add milk when you get
  959. the cup or just before you drink it?
  960.  
  961. ==> physics/milk.and.coffee.s <==
  962. Normalize your temperature scale so that 0 degrees = room temperature.
  963.  
  964. Assume that the coffee cools at a rate proportional to the difference
  965. in temperature, and that the amount of milk is sufficiently small that
  966. the constant of proportinality is not changed when you add the milk.
  967.  
  968. An early calculus homework problem is to compute that the temperature
  969. of the coffee decays exponentially with time,
  970.  
  971. T(t) = exp(-ct) T0,   where T0 = temperature at t=0.
  972.  
  973. Let l = exp(-ct), where t is the duration of the experiment.
  974.  
  975. Assume that the difference in specific heats of coffee and milk are
  976. negligible, so that if you add milk at temperature M to coffee at
  977. temperature C, you get a mix of temperature aM+bC, where a and b 
  978. are constants between 0 and 1, with a+b=1.  (Namely, a = the fraction
  979. of final volume that is milk, and b = fraction that is coffee.)
  980.  
  981. If we let C denote the original coffee temperature and M the milk
  982. temperature, we see that
  983.  
  984. Add milk later: aM + blC
  985. Add milk now:   l(aM+bC) = laM+blC
  986.  
  987. The difference is d=(1-l)aM.  Since l<1 and a>0, we need to worry about
  988. whether M is positive or not.
  989.  
  990. M>0: Warm milk.  So d>0, and adding milk later is better.
  991. M=0: Room temp.  So d=0, and it doesn't matter.
  992. M<0: Cold milk.  So d<0, and adding milk now is better.
  993.  
  994. Of course, if you wanted to be intuitive, the answer is obvious if you
  995. assume the coffee is already at room temperature and the milk is
  996. either scalding hot or subfreezing cold.
  997.  
  998. Moral of the story:  Always think of extreme cases when doing these puzzles.
  999. They are usually the key.
  1000.  
  1001. Oh, by the way, if we are allowed to let the milk stand at room
  1002. temperature, then let r = the corresponding exponential decay constant
  1003. for your milk container.
  1004.  
  1005. Add acclimated milk later:  arM + blC
  1006.  
  1007. We now have lots of cases, depending on whether
  1008.  
  1009. r<l:  The milk pot is larger than your coffee cup.
  1010.       (E.g, it really is a pot.)
  1011. r>l:  The milk pot is smaller than your coffee cup.
  1012.       (E.g., it's one of those tiny single-serving things.)
  1013. M>0:  The milk is warm.
  1014. M<0:  The milk is cold.
  1015.  
  1016. Leaving out the analysis, I compute that you should...
  1017.  
  1018. Add warm milk in large pots LATER.
  1019. Add warm milk in small pots NOW.
  1020. Add cold milk in large pots NOW.
  1021. Add cold milk in small pots LATER.
  1022.  
  1023. Of course, observe that the above summary holds for the case where the
  1024. milk pot is allowed to acclimate; just treat the pot as of infinite
  1025. size.
  1026.  
  1027. ==> physics/mirror.p <==
  1028. Why does a mirror appear to invert the left-right directions, but not up-down?
  1029.  
  1030. ==> physics/mirror.s <==
  1031. Mirrors invert front to back, not left to right.
  1032.  
  1033. The popular misconception of the inversion is caused by the fact that
  1034. a person when looking at another person expects him/her to face her/him,
  1035. so with the left-hand side to the right. When facing oneself (in the
  1036. mirror) one sees an 'uninverted' person. 
  1037.  
  1038. See Martin Gardner, ``Hexaflexagons and other mathematical
  1039. diversions,'' University of Chicago Press 1988, Chapter 16.  A letter
  1040. by R.D. Tschigi and J.L. Taylor published in this book states that the
  1041. fundamental reason is: ``Human beings are superficially and grossly
  1042. bilaterally symmetrical, but subjectively and behaviorally they are
  1043. relatively asymmetrical. The very fact that we can distinguish our
  1044. right from our left side implies an asymettry of the perceiving
  1045. system, as noted by Ernst Mach in 1900. We are thus, to a certain
  1046. extent, an asymmetrical mind dwelling in a bilaterally symmetrical
  1047. body, at least with respect to a casual visual inspection of our
  1048. external form.'' 
  1049.  
  1050. Martin Gardner has also written the book ``The Amidextrous Universe.''
  1051.  
  1052. ==> physics/monkey.p <==
  1053. Hanging over a pulley, there is a rope, with a weight at one end.
  1054. At the other end hangs a monkey of equal weight.  The rope weighs
  1055. 4 ounces per foot.  The combined ages of the monkey and it's mother
  1056. is 4 years.  The weight of the monkey is as many pounds as the mother
  1057. is years old.  The mother is twice as old as the monkey was when the
  1058. mother was half as old as the monkey will be when the monkey is 3 times
  1059. as old as the mother was when she was 3 times as old as the monkey.
  1060.  
  1061. The weight of the rope and the weight is one-half as much again as the
  1062. difference between the weight of the weight and the weight of the weight
  1063. plus the weight of the monkey.
  1064.  
  1065. How long is the rope?
  1066.  
  1067. ==> physics/monkey.s <==
  1068. The most difficult thing about this puzzle, as you probably expected,
  1069. is translating all the convoluted problem statements into equations...
  1070. the solution is pretty trivial after that.  So...
  1071.  
  1072. Let:
  1073.     m represent monkey
  1074.     M represent mother of monkey
  1075.     w represent weight
  1076.     r represent rope
  1077.  
  1078.     W[x] = present weight of x (x is m, M, w, or r)
  1079.     A[x,t] = age of x at time t (x is M or M, t is one of T1 thru T4)
  1080.  
  1081.     T1 = time at which mother is 3 times as old as monkey
  1082.     T2 = time at which monkey is 3 times as old as mother at T1
  1083.     T3 = time at which mother is half as old as monkey at T2
  1084.     T4 = present time
  1085.  
  1086. For the ages, we have:
  1087.  
  1088.     A[M,T1] = 3*A[m,T1]
  1089.     A[m,T2] = 3*A[M,T1] = 9*A[m,T1]
  1090.     A[M,T3] = A[m,T2]/2 = 9*A[m,T1]/2
  1091.     A[m,T3] = A[m,T1] + (T3-T1)
  1092.         = A[m,T1] + (A[M,T3]-A[M,T1])
  1093.         = A[m,T1] + (9*A[M,T1]/2 - 3*A[m,T1])
  1094.         = 5*A[m,T1]/2
  1095.     A[M,T4] = 2*A[m,T3] = 5*A[m,T1]
  1096.     A[m,T4] = A[m,T1] + (T4-T1)
  1097.         = A[m,T1] + (A[M,T4]-A[M,T1])
  1098.         = A[m,T1] + (5*A[m,T1] - 3*A[m,T1])
  1099.         = 3*A[m,T1]
  1100.  
  1101. The present ages of monkey and mother sum to 4, so we have
  1102.  
  1103.     A[m,T4]   + A[M,T4]   = 4
  1104.     3*A[m,T1] + 5*A[m,T1] = 4
  1105.             8*A[m,T1] = 4
  1106.               A[m,T1] = 1/2
  1107.  
  1108. Thus:
  1109.     A[M,T4] = 5/2
  1110.     A[m,T4] = 3/2
  1111.  
  1112. Now for the weights, translating everything to ounces:
  1113.  
  1114. Monkey's weight in lbs = mother's age in years, so:
  1115.  
  1116.     W[m] = 16*5/2 = 40
  1117.  
  1118. Weight and monkey are same weight, so:
  1119.  
  1120.     W[w] = W[m] = 40
  1121.  
  1122. The last paragraph in the problem translates into:
  1123.  
  1124.     W[r]+W[w] = (3/2)*((W[w]+W[m])-W[w])
  1125.     W[r]+ 40  = (3/2)*(( 40 + 40 )- 40 )
  1126.     W[r]+ 40  = 60
  1127.     W[r]      = 20
  1128.  
  1129. The rope weighs 4 ounces per foot, so its length is 5 feet.
  1130.  
  1131. ==> physics/particle.p <==
  1132. What is the longest time that a particle can take in travelling between two
  1133. points if it never increases its acceleration along the way and reaches the
  1134. second point with speed V?
  1135.  
  1136. ==> physics/particle.s <==
  1137. Assumptions:
  1138.  
  1139. 1. x(0) = 0; x(T) = X
  1140.  
  1141. 2. v(0) = 0; v(T) = V
  1142.  
  1143. 3. d(a)/dt <= 0
  1144.  
  1145. Solution:
  1146.  
  1147. a(t) = constant = A = V^2/2X which implies T = 2X/V.
  1148.  
  1149. Proof:
  1150.  
  1151. Consider assumptions as they apply to f(t) = A * t - v(t):
  1152.  
  1153. 1. integral from 0 to T of f = 0
  1154.  
  1155. 2. f(0) = f(T) = 0
  1156.  
  1157. 3. d^2(f)/dt^2 <= 0
  1158.  
  1159. From the mean value theorem, f(t) = 0.  QED.
  1160.  
  1161. ==> physics/pole.in.barn.p <==
  1162. Accelerate a pole of length l to a constant speed of 90% of the speed of
  1163. light (.9c).  Move this pole towards an open barn of length .9l (90%
  1164. the length of the pole).  Then, as soon as the pole is fully inside the
  1165. barn, close the door.  What do you see and what actually happens?
  1166.  
  1167. ==> physics/pole.in.barn.s <==
  1168. What the observer sees depends upon where the observer is, due to
  1169. the finite speed of light.
  1170.  
  1171. For definiteness, assume the forward end of the pole is marked "A" and
  1172. the after end is marked "B".  Let's also assume there is a light source
  1173. inside the barn, and that the pole stops moving as soon as end "B" is
  1174. inside the barn.
  1175.  
  1176. An observer inside the barn next to the door will see the following
  1177. sequence of events:
  1178.  
  1179.     1.  End "A" enters the barn and continues toward the back.
  1180.     2.  End "B" enters the barn and stops in front of the observer.
  1181.     3.  The door closes.
  1182.     4.  End "A" continues moving and penetrates the barn at the far end.
  1183.     5.  End "A" stops outside the barn.
  1184.  
  1185. An observer at the other end of the barn will see:
  1186.  
  1187.     1.  End "A" enters the barn.
  1188.     2.  End "A" passes the observer and penetrates the back of the barn.
  1189.     3.  If the pole has markings on it, the observer will notice the part
  1190.         nearest him has stopped moving.  However, both ends are still 
  1191.         moving.
  1192.     4.  End "A" stops moving outside the barn.
  1193.     5.  End "B" continues moving until it enters the barn and then stops.
  1194.     6.  The door closes.
  1195.  
  1196. After the observers have subtracted out the effects of the finite speed
  1197. of light on what they see, both observers will agree on what happened:
  1198. The pole entered the barn; the door closed so that the pole was
  1199. completely contained within the barn; as the pole was being stopped it
  1200. elongated and penetrated the back wall of the barn.
  1201.  
  1202. Things are different if you are riding along with the pole.  The pole
  1203. is never inside the barn since it won't fit.  End A of the pole penetrates
  1204. the rear wall of the barn before the door is closed.
  1205.  
  1206. If the wall of the barn is impenetrable, in all the above scenarios insert
  1207. the wording "End A of the pole explodes" for "End A penetrates the barn."
  1208.  
  1209. ==> physics/resistors.p <==
  1210. What are the resistances between lattices of resistors in the shape of a:
  1211.  
  1212. 1. Cube 
  1213.  
  1214. 2. Platonic solid
  1215.  
  1216. 3. Hypercube
  1217.  
  1218. 4. Plane sheet
  1219.  
  1220. 5. Continuous sheet
  1221.  
  1222. ==> physics/resistors.s <==
  1223. 1. Cube
  1224.  
  1225. The key idea is to observe that if you can show that two
  1226. points in a circuit must be at the same potential, then you can
  1227. connect them, and no current will flow through the connection and the
  1228. overall properties of the circuit remain unchanged.  In particular, for
  1229. the cube, there are three resistors leaving the two "connection
  1230. corners".  Since the cube is completely symmetrical with respect to the
  1231. three resistors, the far sides of the resistors may be connected
  1232. together.  And so we end up with:
  1233.  
  1234.     |---WWWWWW---|    |---WWWWWW---|
  1235.         |            |    |            |
  1236.      *--+---WWWWWW---+----+---WWWWWW---+---*
  1237.     |            |    |            |
  1238.     |---WWWWWW---|    |---WWWWWW---|
  1239.  
  1240. 2. Platonic Solids
  1241.  
  1242. Same idea for 8 12 and 20, since you use the symmetry to identify
  1243. equi-potential points.  The tetrahedron is hair more subtle:
  1244.  
  1245.     *---|---WWWWWW---|---*
  1246.     |\          /|
  1247.     W W        W W
  1248.     W  W      W  W
  1249.     W   W    W   W
  1250.     |    \  /    |
  1251.      \    ||     |
  1252.           \    |    /
  1253.        \   W   /
  1254.         \  W  /   <-------
  1255.          \ W /
  1256.           \|/
  1257.            +
  1258.  
  1259. By symmetry, the endpoints of the marked resistor are equi-potential.  Hence
  1260. they can be connected together, and so it becomes a simple:
  1261.  
  1262.     *---+---WWWWW---+----*
  1263.     |           |
  1264.     +-WWW   WWW-+
  1265.     |    |-|    |
  1266.     |-WWW   WWW-|
  1267.  
  1268. 3. Hypercube
  1269.  
  1270. Think of injecting a constant current I into the start vertex.
  1271. It splits (by symmetry) into n equal currents in the n arms; the current of
  1272. I/n then splits into I/n(n-1), which then splits into I/[n(n-1)(n-1)] and so
  1273. on till the halfway point, when these currents start adding up. What is the
  1274. voltage difference between the antipodal points? V = I x R; add up the voltages
  1275. along any of the paths:
  1276. n even:                                                         (n-2)/2
  1277.      V = 2{I/n + I/(n(n-1)) + I/(n(n-1)(n-1)) + ... +  I/(n(n-1)       )}
  1278.  
  1279. n odd:                                                      (n-3)/2
  1280.  V = 2{I/n + I/(n(n-1)) + I/(n(n-1)(n-1)) + ... +  I/(n(n-1)       )}    (n-1)/2
  1281.                                                                + I/(n(n-1)     )
  1282. And R = V/I i.e. replace the Is in the above expression by 1s.
  1283.  
  1284. For the 3-cube: R = 2{1/3} + 1/(3x2) = 5/6 ohm
  1285. For the 4-cube: R = 2{1/4 + 1/(4x3)} = 2/3 ohm
  1286.  
  1287. This formula yields the resistance from root to root of
  1288. two (n-1)-ary trees of height n/2 with their end nodes identified
  1289. (-when n is even; something similar when n is odd).
  1290. Coincidentally, the 4-cube is such an animal and thus the answer
  1291. 2/3 ohms is correct in that case.
  1292. However, it does not provide the solution for n >= 5, as the hypercube
  1293. does not have quite as many edges as were counted in the formula above.
  1294.  
  1295. 4. The Infinite Plane
  1296.  
  1297. For an infinite lattice: First inject a constant current I at a point; figure
  1298. out the current flows (with heavy use of symmetry). Remove that current. Draw
  1299. out a current I from the other point of interest (or inject a negative current)
  1300. and figure out the flows (identical to earlier case, but displaced and in the
  1301. other direction). By the principle of superposition, if you inject a current I
  1302. into point a and take out a current I at point b at the same time, the currents
  1303. in the paths are simply the sum of the currents obtained in the earlier two
  1304. simpler cases. As in the n-cube, find the voltage between the points of
  1305. interest, divide by I and voila'!
  1306.  
  1307. As an illustration, in the adjacent points case: we have a current of I/4 in
  1308. each of the four resistors:
  1309.  
  1310.     ^                |
  1311.     |                v
  1312.  <--o-->          -->o<--
  1313.     |                ^
  1314.     v                |
  1315.  (inject)          (take out)
  1316. And adding the currents, we have I/2 in the resistor connecting the two points.
  1317. Therefore V=(1 ohm) x I/2 and effective resistance between the points = 1/2 ohm.
  1318.  
  1319. You can (and showed how to) use symmetry to obtain the equivalent resistance
  1320. of 1/2 between two adjacent nodes; but I doubt that symmetry alone will give you
  1321. even the equivalent resistance of 2/pi between two diagonally adjacent nodes.
  1322. [More generally, the equivalent resistance between two nodes k diagonal units
  1323. apart is (2/pi)(1+1/3+1/5+...+1/(2k-1)); that, plus symmetry and the known
  1324. equivalent resistance between two adjacent nodes, is sufficient to derive all
  1325. equivalent resistances in the lattice.
  1326.  
  1327. 5. Continuous sheet
  1328.  
  1329. Doesn't the resistance diverge in that case?  The problem is that you can't
  1330. inject current at a point.
  1331.  
  1332. cf. "Random Walks and Electric Networks", by Doyle and Snell, published by the
  1333. Mathematical Association of America.
  1334.  
  1335. ==> physics/sail.p <==
  1336. A sailor is in a sailboat on a river.  The water (current) is flowing
  1337. downriver at a velocity of 3 knots with respect to the land.  The wind
  1338. (air velocity) is zero, with respect to the land.  The sailor wants
  1339. to proceed downriver as quickly as possible, maximizing his downstream
  1340. speed with respect to the land.
  1341.  
  1342. Should he raise the sail, or not?
  1343.  
  1344. ==> physics/sail.s <==
  1345. Depends on the sail.  If the boat is square-rigged, then not, since
  1346. raising the sail will simply increase the air resistance.
  1347.  
  1348. If the sailor has a fore-and-aft rig, then he should, since he can then
  1349. tack into the wind.  (Imagine the boat in still water with a 3-knot head
  1350. wind).
  1351.  
  1352. ==> physics/skid.p <==
  1353. What is the fastest way to make a 90 degree turn on a slippery road?
  1354.  
  1355. ==> physics/skid.s <==
  1356. For higher speeds (measured at a small distance from the point of initiation
  1357. of a sharp turn) the fastest way round is to "outside loop" - that is, steer
  1358. away from the curve, and do a kidding 270.
  1359.  
  1360. This technique is taught in advanced driving schools.
  1361.  
  1362. References:
  1363.  
  1364. M. Freeman and P. Palffy, American Journal of Physics, vol 50, p. 1098, 1982.
  1365. P. Palffy and Unruh, American Journal of Physics, vol 49, p. 685, 1981.
  1366.  
  1367. ==> physics/spheres.p <==
  1368. Two spheres are the same size and weight, but one is hollow.  They are
  1369. made of uniform material, though of course not the same material.  Without
  1370. a minimum of apparatus, how can I tell which is hollow?
  1371.  
  1372. ==> physics/spheres.s <==
  1373. Since the balls have equal diameter and equal mass, their volume and
  1374. density are also equal.  However, the mass distribution is not equal,
  1375. so they will have different moments of inertia - the hollow sphere has
  1376. its mass concentrated at the outer edge, so its moment of inertia will
  1377. be greater than the solid sphere.  Applying a known torque and observing
  1378. which sphere has the largest angular acceleration will determine which
  1379. is which.  An easy way to do this is to "race" the spheres down an
  1380. inclined plane with enough friction to prevent the spheres from sliding.  
  1381. Then, by conservation of energy:
  1382.  
  1383.          mgh = 1/2 mv^2 + 1/2 Iw^2
  1384.  
  1385. Since the spheres are rolling without sliding, there is a relationship 
  1386. between velocity and angular velocity:
  1387.  
  1388.         w = v / r
  1389.  
  1390. so
  1391.  
  1392.          mgh = 1/2 mv^2 + 1/2 I (v^2 / r^2) = 1/2 (m + I/r^2) v^2
  1393.  
  1394. and
  1395.  
  1396.          v^2 = 2mgh / (m + I / r^2)
  1397.  
  1398. From this we can see that the sphere with larger moment of inertia (I) will
  1399. have a smaller velocity when rolled from the same height, if mass and radius
  1400. are equal with the other sphere.  Thus the solid sphere will roll faster.
  1401.  
  1402. ==> physics/wind.p <==
  1403. Is a round-trip by airplane longer or shorter if there is wind blowing?
  1404.  
  1405. ==> physics/wind.s <==
  1406. It will take longer, by the ratio (s^2)/(s^2 - w^2) where s is
  1407. the plane's speed, and w is the wind speed.  The stronger the wind the
  1408. longer it will take, up until the wind speed equals the planes speed, at
  1409. which point the plane will never finish the trip.
  1410.  
  1411. Math:
  1412.     s = plane's speed
  1413.     w = wind speed
  1414.     d = distance in one direction
  1415.  
  1416.     d / (s + w)    = time to complete leg flying with the wind
  1417.     d / (s - w)    = time to complete leg flying against the wind
  1418.     d / (s + w) + d / (s - w)    = round trip time
  1419.  
  1420.     d / (s + w) + d / (s - w)    = ratio of flying with wind to
  1421.     -------------------------      flying with no wind (bottom of
  1422.        d / s + d / s          equation is top with w = 0)
  1423.     
  1424.     this simplifies to s^2 / (s^2 - w^2).
  1425.  
  1426. ==> probability/amoeba.p <==
  1427. A jar begins with one amoeba.  Every minute, every amoeba
  1428. turns into 0, 1, 2, or 3 amoebae with probability 25%
  1429. for each case ( dies, does nothing, splits into 2, or splits 
  1430. into 3).  What is the probability that the amoeba population
  1431. eventually dies out?
  1432.  
  1433. ==> probability/amoeba.s <==
  1434. If p is the probability that a single amoeba's descendants will die
  1435. out eventually, the probability that N amoebas' descendents will all
  1436. die out eventually must be p^N, since each amoeba is independent of
  1437. every other amoeba.  Also, the probability that a single amoeba's
  1438. descendants will die out must be independent of time when averaged
  1439. over all the possibilities.  At t=0, the probability is p, at t=1 the
  1440. probability is 0.25(p^0+p^1+p^2+p^3), and these probabilities must be
  1441. equal.  Extinction probability p is a root of f(p)=p.  In this case,
  1442.  p = sqrt(2)-1.
  1443.  
  1444. The generating function for the sequence P(n,i), which gives the
  1445. probability of i amoebas after n minutes, is f^n(x), where f^n(x) ==
  1446. f^(n-1) ( f(x) ), f^0(x) == x .  That is, f^n is the nth composition
  1447. of f with itself.
  1448.  
  1449. Then f^n(0) gives the probability of 0 amoebas after n minutes, since
  1450. f^n(0) = P(n,0). We then note that:
  1451.  
  1452.     f^(n+1)(x) = ( 1 + f^n(x) + (f^n(x))^2 + (f^n(x))^3 )/4
  1453.  
  1454. so that if f^(n+1)(0) -> f^n(0) we can solve the equation.
  1455.  
  1456. The generating function also gives an expression for the expectation
  1457. value of the number of amoebas after n minutes. This is d/dx(f^n(x))
  1458. evaluated at x=1. Using the chain rule we get f'(f^(n-1)(x))*d/dx(f^(n-1)(x))
  1459. and since f'(1) = 1.5  and f(1) = 1, we see that the result is just
  1460. 1.5^n, as might be expected.
  1461.  
  1462. ==> probability/apriori.p <==
  1463. An urn contains one hundred white and black balls.  You sample one hundred
  1464. balls with replacement and they are all white.  What is the probability
  1465. that all the balls are white?
  1466.  
  1467. ==> probability/apriori.s <==
  1468. This question cannot be answered with the information given.
  1469.  
  1470. In general, the following formula gives the conditional probability
  1471. that all the balls are white given you have sampled one hundred balls
  1472. and they are all white:
  1473.  
  1474.     P(100 white | 100 white samples) =
  1475.  
  1476.             P(100 white samples | 100 white) * P(100 white) 
  1477.         -----------------------------------------------------------
  1478.         sum(i=0 to 100) P(100 white samples | i white) * P(i white)
  1479.  
  1480. The probabilities P(i white) are needed to compute this formula.  This
  1481. does not seem helpful, since one of these (P(100 white)) is just what we
  1482. are trying to compute.  However, the following argument can be made:
  1483. Before the experiment, all possible numbers of white balls from zero to
  1484. one hundred are equally likely, so P(i white) = 1/101.  Therefore, the
  1485. odds that all 100 balls are white given 100 white samples is:
  1486.  
  1487.     P(100 white | 100 white samples) =
  1488.  
  1489.         1 / ( sum(i=0 to 100) (i/100)^100 ) =
  1490.  
  1491.         63.6%
  1492.  
  1493. This argument is fallacious, however, since we cannot assume that the urn
  1494. was prepared so that all possible numbers of white balls from zero to one
  1495. hundred are equally likely.  In general, we need to know the P(i white)
  1496. in order to calculate the P(100 white | 100 white samples).  Without this
  1497. information, we cannot determine the answer.
  1498.  
  1499. This leads to a general "problem": our judgments about the relative
  1500. likelihood of things is based on past experience.  Each experience allows
  1501. us to adjust our likelihood judgment, based on prior probabilities.  This
  1502. is called Bayesian inference.  However, if the prior probabilities are not
  1503. known, then neither are the derived probabilities.  But how are the prior
  1504. probabilities determined?  For example, if we are brains in the vat of a
  1505. diabolical scientist, all of our prior experiences are illusions, and
  1506. therefore all of our prior probabilities are wrong.
  1507.  
  1508. All of our probability judgments indeed depend upon the assumption that
  1509. we are not brains in a vat.  If this assumption is wrong, all bets are
  1510. off.
  1511.  
  1512. ==> probability/cab.p <==
  1513. A cab was involved in a hit and run accident at night.  Two cab companies,
  1514. the Green and the Blue, operate in the city.  Here is some data:
  1515.  
  1516.     a)  Although the two companies are equal in size, 85% of cab 
  1517. accidents in the city involve Green cabs and 15% involve Blue cabs.
  1518.  
  1519.     b)  A witness identified the cab in this particular accident as Blue.
  1520. The court tested the reliability of the witness under the same circumstances
  1521. that existed on the night of the accident and concluded that the witness 
  1522. correctly identified each one of the two colors 80% of the time and failed
  1523. 20% of the time.
  1524.  
  1525. What is the probability that the cab involved in the accident was 
  1526. Blue rather than Green?
  1527.  
  1528. If it looks like an obvious problem in statistics, then consider the
  1529. following argument:
  1530.  
  1531. The probability that the color of the cab was Blue is 80%!  After all,
  1532. the witness is correct 80% of the time, and this time he said it was Blue!
  1533.  
  1534. What else need be considered?  Nothing, right?
  1535.  
  1536. If we look at Bayes theorem (pretty basic statistical theorem) we 
  1537. should get a much lower probability.  But why should we consider statistical
  1538. theorems when the problem appears so clear cut?  Should we just accept the 
  1539. 80% figure as correct?
  1540.  
  1541. ==> probability/cab.s <==
  1542. The police tests don't apply directly, because according to the
  1543. wording, the witness, given any mix of cabs, would get the right
  1544. answer 80% of the time.  Thus given a mix of 85% green and 15% blue
  1545. cabs, he will say 20% of the green cabs and 80% of the blue cabs are
  1546. blue.  That's 20% of 85% plus 80% of 15%, or 17%+12% = 29% of all the
  1547. cabs that the witness will say are blue.  Of those, only 12/29 are
  1548. actually blue.  Thus P(cab is blue | witness claims blue) = 12/29.
  1549. That's just a little over 40%.
  1550.  
  1551. Think of it this way... suppose you had a robot watching parts on a
  1552. conveyor belt to spot defective parts, and suppose the robot made a
  1553. correct determination only 50% of the time (I know, you should
  1554. probably get rid of the robot...).  If one out of a billion parts are
  1555. defective, then to a very good approximation you'd expect half your
  1556. parts to be rejected by the robot.  That's 500 million per billion.
  1557. But you wouldn't expect more than one of those to be genuinely
  1558. defective.  So given the mix of parts, a lot more than 50% of the
  1559. REJECTED parts will be rejected by mistake (even though 50% of ALL the
  1560. parts are correctly identified, and in particular, 50% of the
  1561. defective parts are rejected).
  1562.  
  1563. When the biases get so enormous, things starts getting quite a bit
  1564. more in line with intuition.
  1565.  
  1566. For a related real-life example of probability in the courtroom see
  1567. People v. Collins, 68 Cal 2d319 (1968).
  1568.  
  1569. ==> probability/coincidence.p <==
  1570. Name some amazing coincidences.
  1571.  
  1572. ==> probability/coincidence.s <==
  1573. The answer to the question, "Who wrote the Bible," is, of
  1574. course, Shakespeare. The King James Version was published in
  1575. 1611. Shakespeare was 46 years old then (he turned 47 later in
  1576. the year). Look up Psalm 46. Count 46 words from the beginning of
  1577. the Psalm. You will find the word "Shake." Count 46 words from
  1578. the end of the Psalm. You will find the word "Spear." An obvious
  1579. coded message. QED.
  1580.  
  1581. How many inches in the pole-to-pole diameter of the Earth?  The
  1582. answer is almost exactly 500,000,000 inches.  Proof that the inch
  1583. was defined by spacemen.
  1584.  
  1585.  
  1586. ==> probability/coupon.p <==
  1587. There is a free gift in my breakfast cereal. The manufacturers say
  1588. that the gift comes in four different colours, and encourage one to
  1589. collect all four (& so eat lots of their cereal). Assuming there is
  1590. an equal chance of getting any one of the colours,  what is the
  1591. expected number of packets I must plough through to get all four?
  1592. Can you generalise to n colours and/or unequal probabilities?
  1593.  
  1594.